$(function(){
$( '#gologin' ).button();
$('#login_form').ajaxForm( 
{
        url:      'login.php',
        type:     'POST',   
        dataType: 'json',
        success: result_processing,
        beforeSubmit: function() {
                $('#login_mess').text('').fadeOut('normal');            
        }
});    

function result_processing( rsp ) {
            if( rsp.errcode ) {
                $('#login_mess').html(rsp.errmess).fadeIn('slow', function() {
                        setTimeout( function() { $('#login_mess').fadeOut('normal')}, 5000 );
                    });                
            }
            else
                document.location.href = rsp.data.url;
        }
}); // End of onready
